<!DOCTYPE html>
<html>
<head>
    <title>console</title>
    <style>
        .safe-close {
            position: absolute;
        }

        .safe-close button {
            color: red;
        }
    </style>
</head>
<body onload="setFocus()" style="margin: 0;">
    <div class="safe-close">
        <button onclick="javascript:window.open('?vncid={{ vncid }}&close=1', '_self')">关闭</button>
    </div>
    <div>
        <iframe id="novnc" src="{{ url }}" width="100%" onload="layout()"></iframe>
    </div>
    <script type="text/javascript">
        function setFocus() {
            document.getElementById("novnc").focus();
        }

        function layout() {
            var ifm = document.getElementById("novnc");
            ifm.width = document.body.clientWidth;
            ifm.height = window.innerHeight;
        }
        window.onresize = function () {
            layout();
        }
    </script>
</body>
</html>